package jd.jd2;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

import java.util.Map;

@Aspect
public class EquipUpdate {

    @Before("execution(* jd.jd2.service.PlayerService.*(..))")
    public void before(JoinPoint jp){
        Equip e=(Equip) jp.getArgs()[0];
        if("指环".equals(e.getType())){
            //使用前置增强修改要传入方法的参数
            @SuppressWarnings("unchecked")
            Map<String,String> map=(Map<String, String>) jp.getArgs()[1];
            map.put("name", "紫色梦幻+");
            map.put("attack", "6");
            map.put("defence", "6");
        }
    }

}
